<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Task Log</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            background-image: url('https://s2.loli.net/2024/05/13/oDmLOVNUujC8ZMS.jpg');
            background-size: cover;
            background-position: center;
            margin: 0;
            padding: 0;
            height: 100vh;

        }
        .container {
            background-color: rgba(255, 255, 255, 0.3); /* 设置框的透明度 */
            border-radius: 8px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
            padding: 20px;
            max-width: 800px;
            margin: auto;
            text-align: center; /* 居中对齐 */
        }
        h1 {
            text-align: center;
            color: #ffffff;
            font-size: 4em; /* 调整标题字体大小 */
            font-family: "Times New Roman", Times, serif;
        }
        ul {
            list-style-type: none;
            padding: 0;
            margin-top: 20px; /* 调整间距 */
        }
        li {
            background-color: rgba(224, 224, 224, 0.8); /* 设置每行的透明度 */
            margin: 5px 0;
            padding: 10px;
            border-radius: 4px;
            font-size: 1.2em; /* 调整行字体大小 */
            color: #333; /* 设置字体颜色 */
            font-family: "黑体", Times, serif;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>任务进程</h1>
        <ul id="log">
            <!-- 日志内容会动态添加到这里 -->
        </ul>
    </div>
    <script>
        function fetchStatus() {
            fetch('/check_status')
                .then(response => response.json())
                .then(data => {
                    const logElement = document.getElementById('log');
                    logElement.innerHTML = '';
                    if (data.log) {
                        data.log.forEach(entry => {
                            const li = document.createElement('li');
                            li.textContent = entry;
                            logElement.appendChild(li);
                        });
                    }
                    if (data.status === 'done') {
                        window.location.href = '/ppt_result?purl=' + encodeURIComponent(data.ppt_url);
                    } else {
                        setTimeout(fetchStatus, 5000);
                    }
                });
        }

        fetchStatus();
    </script>
</body>
</html>
